//
//  LoginResetSecretView.m
//  HaiGeEr_Student
//
//  Created by liuchen on 2018/9/10.
//  Copyright © 2018年 海格尔. All rights reserved.
//

#import "LoginResetSecretView.h"
@interface LoginResetSecretView()
@property (nonatomic,weak) UILabel *title;
@end

@implementation LoginResetSecretView

- (instancetype)initWithFrame:(CGRect)frame WithJudge:(BOOL)judge{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViewWithJudge:judge];
    }
    return self;
}

#pragma mark ==========创建视图==========
- (void)createSubViewWithJudge:(BOOL)judge{
    //视图
    UILabel *title = [[UILabel alloc]init];
    title.text = @"重置默认密码";
    title.textAlignment = NSTextAlignmentCenter;
    title.font = [UIFont fontWithName:@"Arial-BoldMT" size:LoginFont+9];
    title.textColor = RGBA(50, 50, 50, 1);
    _title = title;
    [self addSubview:self.title];
    if (!judge) {
        LoginInPutWithHideView *secretWithOldView = [[LoginInPutWithHideView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) WithImageName:@"7-1-4" WithTitle:@"请输入原密码" WithLocation:1];
        [secretWithOldView addHideBtn];
        _secretWithOldView = secretWithOldView;
        [self addSubview:self.secretWithOldView];
    }
    LoginInPutWithHideView *secretWithNewView = [[LoginInPutWithHideView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) WithImageName:@"7-1-4" WithTitle:@"请输入新密码" WithLocation:1];
    [secretWithNewView addHideBtn];
    _secretWithNewView = secretWithNewView;
    [self addSubview:self.secretWithNewView];
    LoginInPutWithHideView *sureSecretWithNewView = [[LoginInPutWithHideView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) WithImageName:@"7-1-4" WithTitle:@"请再次输入新密码" WithLocation:1];
    [sureSecretWithNewView addHideBtn];
    _sureSecretWithNewView = sureSecretWithNewView;
    [self addSubview:self.sureSecretWithNewView];
    
    //布局
    WS(ws);
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(ws);
        make.height.mas_equalTo(230*SCALEUNIT);
    }];
    if (!judge) {
        [self.secretWithOldView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(ws.title.mas_bottom).with.offset(30*SCALEUNIT);
            make.centerX.mas_equalTo(ws);
            make.size.mas_equalTo(CGSizeMake(615*SCALEUNIT, 75*SCALEUNIT));
        }];
    }
    [self.secretWithNewView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.title.mas_bottom).with.offset(judge?30*SCALEUNIT:135*SCALEUNIT);
        make.centerX.mas_equalTo(ws);
        make.size.mas_equalTo(CGSizeMake(615*SCALEUNIT, 75*SCALEUNIT));
    }];
    [self.sureSecretWithNewView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.secretWithNewView.mas_bottom).with.offset(30*SCALEUNIT);
        make.centerX.mas_equalTo(ws);
        make.size.mas_equalTo(CGSizeMake(615*SCALEUNIT, 75*SCALEUNIT));
    }];
}

@end
